Repository navigation
[Payment due @marufsharifi] Warn before saving an agent rule that RuleBot can't carry out - #104807
Conversation
🦜 Polyglot Parrot! 🦜Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues: View the translation diffdiff --git a/src/languages/de.ts b/src/languages/de.ts
index c68d5bff..0b2355d4 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -8823,7 +8823,7 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
createRule: 'Regel erstellen',
createAnyway: 'Trotzdem erstellen',
saveAnyway: 'Trotzdem speichern',
- checkingRule: 'Ihre Regel wird geprüft...',
+ checkingRule: 'Ihre Regel wird überprüft ...',
fallbackBanner:
'Dies ist keine Standardregel, daher haben wir sie als Agentenregel erstellt. Agentenregeln greifen, nachdem sich eine Ausgabe oder ein Bericht geändert hat, zum Beispiel indem sie die Ausgabe zurückhalten oder den Bericht ablehnen.',
fallbackBannerWithExplanation: (explanation: string) => `Dies ist keine Standardregel, daher haben wir sie als Agentenregel formuliert. ${explanation}`,
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index ca9efc6e..a107fdf5 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -8846,7 +8846,7 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
createRule: 'Créer une règle',
createAnyway: 'Créer quand même',
saveAnyway: 'Enregistrer quand même',
- checkingRule: 'Vérification de votre règle...',
+ checkingRule: 'Vérification de votre règle…',
fallbackBanner:
'Ce n’est pas une règle standard, nous l’avons donc rédigée comme une règle d’agent. Les règles d’agent agissent après la modification d’une dépense ou d’une note de frais, par exemple en bloquant la dépense ou en rejetant la note de frais.',
fallbackBannerWithExplanation: (explanation: string) => `Ce n’est pas une règle standard, nous l’avons donc rédigée comme une règle d’agent. ${explanation}`,
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 87b560c1..56b1861f 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -8661,9 +8661,9 @@ ${reportName}`,
describeRuleForConcierge: 'ルールの内容を入力すると、Concierge が自動作成します',
gotIt: '了解しました',
createRule: 'ルールを作成',
- createAnyway: 'このまま作成',
+ createAnyway: 'それでも作成',
saveAnyway: 'このまま保存',
- checkingRule: 'ルールを確認しています...',
+ checkingRule: 'ルールを確認しています…',
fallbackBanner:
'これは標準ルールではないため、エージェントルールとして作成しました。エージェントルールは、経費やレポートに変更があった後に動作し、例えば経費を保留にしたり、レポートを却下したりします。',
fallbackBannerWithExplanation: (explanation: string) => `これは標準ルールではないため、エージェントルールとして作成しました。${explanation}`,
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 1e9357e7..a5d6be34 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -8778,7 +8778,7 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
createRule: 'Utwórz regułę',
createAnyway: 'Utwórz mimo to',
saveAnyway: 'Zapisz mimo to',
- checkingRule: 'Sprawdzanie reguły...',
+ checkingRule: 'Sprawdzanie twojej reguły...',
fallbackBanner:
'To nie jest standardowa reguła, więc przygotowaliśmy ją jako regułę agenta. Reguły agenta działają po zmianie wydatku lub raportu, na przykład wstrzymując wydatek albo odrzucając raport.',
fallbackBannerWithExplanation: (explanation: string) => `To nie jest standardowa reguła, więc przygotowaliśmy ją jako regułę agenta. ${explanation}`,
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index 50b347c7..2ad2a549 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -8452,7 +8452,7 @@ ${reportName}`,
createRule: '创建规则',
createAnyway: '仍然创建',
saveAnyway: '仍然保存',
- checkingRule: '正在检查你的规则...',
+ checkingRule: '正在检查您的规则…',
fallbackBanner: '这不是一条标准规则,所以我们将其制定为代理规则。代理规则会在报销或报表发生变更后生效,例如暂扣该报销或驳回该报表。',
fallbackBannerWithExplanation: (explanation: string) => `这不是一条标准规则,因此我们将其起草为代理规则。${explanation}`,
},
Note You can apply these changes to your branch by copying the patch to your clipboard, then running |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@marufsharifi Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Okay @JS00001 @rushatgabhane this is ready to go |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppaz_recorder_20261029_190620.mp4Android: mWeb Chromeaz_recorder_20261029_165706.mp4iOS: HybridAppScreen.Recording.2026-10-29.at.6.16.37.PM.moviOS: mWeb SafariScreen.Recording.2026-10-29.at.6.51.45.PM.movMacOS: Chrome / SafariPR-104907.mp4 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eada7520e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
BUG#1: Pending Agent Rule Check Creates a Rule While Discard Confirmation Is OpenSteps to Reproduce:
Expected Result: The pending rule creation should not proceed independently of the discard confirmation. If the admin confirms discarding, the new rule should not be created. Actual Result: The rule is created while the discard confirmation is open. The RuleBot creation confirmation also appears. After the user confirms discarding, the newly created rule remains in the Agents list RF-1.mp4 |
BUG#2: Navigating Back During Validation from Agent Rule doesn't show Discard modal.Steps to Reproduce:
Expected Result: The rule changes should be saved, or the user should receive a confirmation before leaving and discarding the pending changes. Actual Result: The Edit page closes without a confirmation. When the user reopens the rule, the original text is still displayed, and the changes submitted for saving have been lost. RF-2.mp4 |
Confirmation#1: Impossible Rule Warning Is Hidden When Switching to Suggested TabSteps to Reproduce:
Expected Result: The user should be informed when the check returns an impossible response, even while viewing Suggested. Actual Result: No warning is displayed on the Suggested tab, requiring the user to return to the Custom tab to check whether the process was approved or refused and, if refused, view the explanation. cc @joekaufmanexpensify @JS00001 @garrettmknight CF-1.mp4 |
Confirmation#2: Agent Rule Saves While Custom Tab Is HiddenSteps to Reproduce:
Expected Result: The user should receive clear feedback about the pending rule creation while viewing Suggested, without an unexpected screen transition. Actual Result: The rule is automatically created and the New rule panel closes while the user is viewing Suggested, without another interaction. cc @joekaufmanexpensify @JS00001 @garrettmknight CF-2.mp4 |
|
@yuwenmemon, back to you. thanks. |
|
Thanks @marufsharifi!
|
|
🎯 @marufsharifi, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
JS00001
left a comment
There was a problem hiding this comment.
question and a NAB, feel free to merge this
| const optimisticData: Array<OnyxUpdate<CheckAgentRuleKey>> = [ | ||
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: formID, | ||
| value: {isLoading: true}, | ||
| }, | ||
| ]; |
There was a problem hiding this comment.
Do we need a finallyData value as well that clears isLoading?
| ); | ||
| } | ||
|
|
||
| ImpossibleRuleNotice.displayName = 'ImpossibleRuleNotice'; |
There was a problem hiding this comment.
I dont think we use displayName in e/app anymore:
When writing a function component do not explicitly add `displayName` property when component name matches with displayName. A few components such as higher-order components, may need the `displayName` property (this is so it appears properly in the React dev tools)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Not waiting for stuck Codecov |
|
🚧 yuwenmemon has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.5.36-0 🚀
|
|
No help site update needed — this adds a self-explanatory warning before saving unsupported agent rules, and the existing creation and editing instructions remain accurate. |
|
Created Update FullStory for E/A#104807 Agent rule capability checks and warning overrides, labeled Recommended four high-confidence updates: mask refusal details, identify Create anyway and Save anyway buttons, and track asynchronous check outcomes using existing |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.5.36-0 🚀
Bundle Size Analysis (Sentry): |
|
🤖 Payment issue created: #106682 |
Explanation of Change
Admins can type an agent rule straight into the agent rule page, and the AI rules builder never sees it. A rule that RuleBot can't carry out still saves, adds RuleBot as an admin and never runs. This checks a typed or edited rule with
GenerateRulewhen the admin taps Create rule or Save. Animpossibleanswer shows the describe box's refusal, and the button becomes Create anyway or Save anyway, because this only warns. Any other answer, a failed check, or no answer within 20 seconds saves as before. A suggestion or a describe flow draft that the admin leaves unchanged skips the check, because Concierge wrote it.The check runs for every admin, because App#104861 removed the
describeRulebeta. Web-Expensify#56886, which letsGenerateRuleanswerimpossible, is in production.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/683438
PROPOSAL: N/A
Tests
The backend answers
impossibleonly after Web-Expensify#56886, so the snippet below swaps the backend's answer foranswerin the browser and keeps itsgenerationID.answer = {state: 'impossible', reason: 'noCapability', explanation: "Agents can't send text messages.", suggestedPrompt: 'When a report is submitted, send the approver a direct message.'}.Console snippet that swaps the GenerateRule answer locally
Offline tests
QA Steps
Staging answers
impossibleonly after Web-Expensify#56886. Until then, check that saving still works:PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari